import { IFormApi } from '@/components/form/BmForm'
import { BmImageUpload } from '@/components/form/BmImageUpload'
import { BmInput } from '@/components/form/BmInput'
import { BmRadioGroup } from '@/components/form/BmRadioGroup'
import { BmTextarea } from '@/components/form/BmTextarea'
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
import { FC } from 'react'

export const Base: FC<{ form: IFormApi<Record<string, any>> }> = ({ form }) => {
  return (
    <main className="grid grid-cols-2 gap-3">
      <Card>
        <CardHeader>
          <CardTitle>基本配置</CardTitle>
        </CardHeader>
        <CardContent>
          <BmInput fieldName={'common.app_name'} formObject={form} label={'网站名称'} />
          <BmInput fieldName={'common.app_icp'} formObject={form} label={'ICP备案号'} />
          <BmInput fieldName={'common.copyright'} formObject={form} label={'版权信息'} />
          <BmInput fieldName={'common.wechat'} formObject={form} label={'官方微信'} />
          <BmInput fieldName={'common.email'} formObject={form} label={'网站邮箱'} />
          <BmImageUpload formObject={form} fieldName={'common.app_logo'} label="网站 LOGO" />
        </CardContent>
      </Card>
      <Card>
        <CardHeader>
          <CardTitle>维护模式</CardTitle>
        </CardHeader>
        <CardContent>
          <BmRadioGroup
            fieldName={'common.site_open'}
            formObject={form}
            label={'开启网站'}
            options={[
              { label: '开启', value: 1, id: 'open' },
              { label: '关闭', value: 2, id: 'close' }
            ]}
          />
          <BmTextarea fieldName={'common.site_close_message'} formObject={form} label={'关闭时的维护信息'} />
        </CardContent>
      </Card>
    </main>
  )
}
